//
//  HelperAppDelegate.h
//  UnityCapture
//
//  Created by Adrian on 27.10.09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import <QuickTime/QuickTime.h>

#import "UnityCaptureProtocols.h"

#ifdef MAC_OS_X_VERSION_10_6
#define APPLICATION_DELEGATE NSApplicationDelegate,
#else
#define APPLICATION_DELEGATE
#endif

enum {
	UCExistingOverwrite,
	UCExistingNumberSequentially,
	UCExistingChooseNew,
	UCExistingError
};
typedef NSUInteger UCOverwriteStrategy;

@interface HelperAppDelegate : NSObject <APPLICATION_DELEGATE UCHelperAppProtocol> {
    
	// INTERFACE ELEMENTS
	NSWindow *window;
	
	NSButton *disclosure;
	NSButton *pathChangeButton;
	NSButton *pathShowButton;
	NSButton *codecChangeButton;
	NSButton *startStopButton;
	
	NSButton *windowOnTopButton;
	
	NSPopUpButton *overwriteModeButton;
	
	NSTextField *pathField;
	NSTextField *codecField;
	NSTextField *fpsField;
	
	NSTextField *statFpsField;
	NSTextField *statTimeField;
	
	NSImageView *recordIcon;
	
	NSPopUpButton *resolutionPopupButton;
	NSMenuItem *playerResolutionItem;
	NSView *customResolutionView;
	NSTextField *widthTextField;
	NSTextField *heightTextField;
	
	ComponentInstance component;
	
	NSString *outputPath;
	unsigned pathNumbering;
	UCOverwriteStrategy overwriteStrategy;
	
	BOOL settingsVisible;
	
	double framesPerSecond;
	CodecType codecType;
	BOOL windowOnTop;
	
	NSSize captureResolution;
	
	BOOL captureRunning;
	
	NSConnection *serverConnection;
	NSConnection *clientConnection;
	NSDistantObject *coreProxy;
	id <UCCoreProtocol> coreProto;
}

// ITERFACE ELEMENTS
@property (assign) IBOutlet NSWindow *window;

@property (assign) IBOutlet NSButton *disclosure;
@property (assign) IBOutlet NSButton *pathChangeButton;
@property (assign) IBOutlet NSButton *pathShowButton;
@property (assign) IBOutlet NSButton *codecChangeButton;
@property (assign) IBOutlet NSButton *startStopButton;

@property (assign) IBOutlet NSButton *windowOnTopButton;

@property (assign) IBOutlet NSPopUpButton *overwriteModeButton;

@property (assign) IBOutlet NSTextField *pathField;
@property (assign) IBOutlet NSTextField *codecField;
@property (assign) IBOutlet NSTextField *fpsField;

@property (assign) IBOutlet NSTextField *statFpsField;
@property (assign) IBOutlet NSTextField *statTimeField;

@property (assign) IBOutlet NSImageView *recordIcon;

@property (assign) IBOutlet NSPopUpButton *resolutionPopupButton;
@property (assign) IBOutlet NSMenuItem *playerResolutionItem;
@property (assign) IBOutlet NSView *customResolutionView;
@property (assign) IBOutlet NSTextField *widthTextField;
@property (assign) IBOutlet NSTextField *heightTextField;

// ACTIONS
- (IBAction)toggleSettings:(NSButton*)sender;
- (IBAction)changeOutputPath:(id)sender;
- (IBAction)showOutputPath:(id)sender;
- (IBAction)changeCompressionSettings:(id)sender;
- (IBAction)toggleWindowOnTop:(NSButton*)sender;
- (IBAction)changeOverwriteStrategy:(NSPopUpButton*)sender;
- (IBAction)toggleCapture:(NSButton*)sender;
- (IBAction)resolutionPresetChanged:(id)sender;
- (void)toggleCapture;
- (void)startCapture;
- (void)stopCapture;

@end

